﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MxTol.Managers.Helpers
{
    /// <summary>
    /// 数据库分页帮助类
    /// </summary>
    internal class PaginationHelper
    {
        private static PaginationBase m_paginationBase;

        static PaginationHelper()
        {
            string connStr = ManagerConfig.ConnectionString;
            string procedure = "proc_PageResult_SelectSub";

            m_paginationBase = new PaginationBase(connStr,procedure);
        }

        /// <summary>
        /// 根据查询语句获取符合EasyUI表格控件所需格式的json数据
        /// </summary>
        /// <param name="currentPage">当前页面索引</param>
        /// <param name="pageSize">返回页面记录条数</param>
        /// <param name="sql">查询语句</param>
        public static string GetJsonBySql(int currentPage, int pageSize, string sql)
        {
            return m_paginationBase.GetJsonBySql(currentPage,pageSize,sql);
        }

        /// <summary>
        /// 根据查询语句获取所有json数据
        /// </summary>
        public static string GetJsonBySql(string sql)
        {
            return m_paginationBase.GetJsonBySql(sql);
        }
    }
}